home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 228_01 / system.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-07-29  |  1.4 KB  |  43 lines

  1. /*
  2. HEADER:         CUGXXX;
  3. TITLE:          Lattice V2.13 system call;
  4. DATE:           3-20-86;
  5. DESCRIPTION:    Replaces Lattice V2.13 system call which ignores switchar
  6.                 setting before invoking secondary command processor. 
  7. KEYWORDS:       System calls, child process, command processor;
  8. FILENAME:       SYSTEM.C;
  9. WARNINGS:       For dated version of Lattice C;
  10. AUTHORS:        Jeff Spidle;
  11. COMPILER:       Lattice C;
  12. REFERENCES:     US-DISK 1310;
  13. ENDREF
  14. */
  15. /* replaces the system call that is in the lattice 2.13 libraries
  16.    the old call doesn't figure out what the switchar is before
  17.    trying to invoke a secondary command processor. Thus we have
  18.    built a copy that will do just that.
  19.    Program by Jeff Spidle
  20.           Office of Continuing Education
  21.           Iowa State University
  22.           Ames, IA 50011
  23.  
  24. */
  25.  
  26. #include <dos.h>
  27. char *getenv() ;
  28. int system( command_string )
  29. char *command_string ; /* string to be sent to command.com */
  30. {
  31. union REGS in_regs, out_regs ;
  32.  
  33. /* now determine what the swichar is */
  34. in_regs.h.ah = 0x37 ;
  35. in_regs.h.al = 0 ;
  36. intdos( &in_regs, &out_regs ) ;
  37. if (out_regs.h.dl == 45) /* have a - for a switchar */
  38.   return( forkl( getenv("COMSPEC"), 0, "-C", command_string, 0)) ;
  39. else
  40.   return( forkl( getenv("COMSPEC"), 0, "/C", command_string, 0)) ;
  41.  
  42. }
  43.